import { deepCopy, ControlVOBase } from '@ibiz-core';
import { ControlService } from './control-service';

/**
 * 部件展示数据对象
 * @export
 * @class ControlVO
 */
export class ControlVO extends ControlVOBase {
  // 表单里映射了属性的字段
  get srfkey() {
    return this.$DO.bookid;
  }
  set srfkey(value: any) {
    this.$DO.bookid = value;
  }

  get bookid() {
    return this.$DO.bookid;
  }
  set bookid(value: any) {
    this.$DO.bookid = value;
  }

  get namefield() {
    return this.$DO.bookname;
  }
  set namefield(value: any) {
    this.$DO.bookname = value;
  }

  // 表单里没有映射实体属性的字段
  field1: any;
  field2: any;
  field3: any;

  /**
   * 用后台数据对象创建部件数据对象
   * @param data 后台数据
   */
  constructor(data: any){
    super(data);
    // 记录没有映射的属性
    this.$ownKeys = ['field1', 'field2', 'field3'];
  }

}

export const ControlConfig = {
  controlCodeName: 'deform',
  controlName: 'form',
  showBusyIndicator: false,
  controlService: new ControlService(),
  data: new ControlVO({}),
};
